/**
 * 
 */
package com.geezdata.cps.admin.task.job;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import com.geezdata.cps.ttk.integration.common.CommonIntegrationService;
import com.geezdata.cps.ttk.query.query.JobService;

/**
 * @author sszheng
 * @date 创建时间：2017年10月18日 下午5:37:04
 *
 */
public class CommonJob implements Job {

	@Autowired
	private JobService jobService;
	@Autowired
	private CommonIntegrationService commonIntegrationService;
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		String triggerName = context.getTrigger().getKey().getName();
		com.geezdata.cps.ttk.domain.domain.Job job = jobService.getJobByTriggerName(triggerName);
		commonIntegrationService.request(job.getCallbackUrl(), job.getParams());
	}
}
